<include file="Public/head" xmlns="http://www.w3.org/1999/html"/>
<include file="Public/common_header" />
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/css/cashier.css" />
<div class="mian">
    <include file="Public/sidebar" menu="hdgl.cchd"  />
    <div class="mianR">
        <div class="live-cont">
            <div class="new-live">
                <ul class="modify">
                    <li>
                        <span>活动名称：</span>
                        {$arr.scene_activity_arr.name}
                    </li>
                    <li>
                        <span>活动类型：</span>
                        {$arr.scene_activity_arr.type}
                    </li>
                    <li>
                        <span>所属分公司：</span>
                        {$arr.scene_activity_arr.branch_name}
                    </li>
                    <li>
                        <span>活动规则：</span>
                        {$arr.scene_activity_arr.rules_type}
                    </li>
                    <li>
                        <span>活动时间：</span>
                        {$arr.scene_activity_arr.starttime}  - {$arr.scene_activity_arr.endtime}
                    </li>
                    <if condition="$arr['scene_activity_arr']['rules_type_id'] eq 1">
                        <li class="new-live-loan">
                            <span class="new-live-money">金额：</span>
                            {$arr.scene_activity_arr.amount}
                        </li>
                    </if>
                </ul>
            </div>
            <div class="add-rule clearfix" style="display: block;">
                <foreach name="arr.activity_rules_arr" item="rules">
                    <div class="rule-text">
                        <h4>活动规则</h4>
                            <ul>
                                <li><span>当竞拍价 ≥</span>
                                    <span class="rule-money">{$rules.min_bid_price}</span><i>元</i>
                                </li>
                                <li><span>当竞拍价 ≤</span>
                                    <span class="rule-money">{$rules.max_bid_price}</span><i>元</i>
                                </li>
                                <li><span>减免</span>
                                    <span class="rule-money">{$rules.amount}</span><i>元</i>
                                </li>
                            </ul>
                    </div>
                </foreach>
            </div>
            <div class="yongBtn">
                <input type="button" value="关闭" class="queding" onclick="back();">
                <if condition="$act eq 'enable'">
                    <input type="button" name="btn_enable" value="启用" class="queding" onclick="confirm({$arr.scene_activity_arr.id},'enable','1')">
                <elseif condition="$act eq 'disable'"/>
                    <input type="button" name="btn_disable" value="禁用" class="queding" onclick="confirm({$arr.scene_activity_arr.id},'disable','0')">
                </if>
            </div>
        </div>
        <div class="clear"></div>
    </div>
</div>

<div class="chenggong1">
    <span class="paidan">您确定要<i>启用</i>活动吗?</span>
    <div class="shenhei-btn">
        <input type="hidden" name="act"  value="" />
        <input type="hidden" name="status"  value="" />
        <input type="hidden" name="activity_id"  value="" />
        <input type="button" value="确定" class="determine" />
        <input type="button" value="取消" class="cancel" />
    </div>
</div>

<script>
   //启用/禁用 窗口
   function confirm(activity_id, act , status) {
       $('.chenggong1').css('display', 'block');
       $('.yunBei').css({'display':'block',"zIndex":999});

       $('input[name=activity_id]').val(activity_id);
       if (act == 'enable') {
           $('.paidan i').text('启用');
           $('input[name=act]').val('enable');
       } else if (act == 'disable') {
           $('.paidan i').text('禁用');
           $('input[name=act]').val('disable');
       }
       $('input[name=status]').val(status);
   }

   //
   $(".determine").on('click', function () {
       var act = $('input[name=act]').val();
       var status = $('input[name=status]').val();
       var activity_id = $('input[name=activity_id]').val();
       var param = {};
       param = {
           'status': status,
           'id': activity_id,
       };
       var btn_obj = $(this);
       btn_obj.val("提交中...").attr("disabled",'disabled');
       $.post('/SceneActivity/enableOrDisableActivity', param, function (data) {
           if (data.code == '200') {
               console.log(data);
               delay_alert('操作成功!');
               setTimeout(function () {
                   back();
               }, 300);
           } else {
               shibai_alert(data.msg)
               btn_obj.val("确定").removeAttr("disabled style");
               $('.chenggong1').fadeOut();
           }
           $('.yunBei').css({'display':'none',"zIndex":999});
       }, 'json');
   });

   $(".cancel").on('click', function () {
       $('.chenggong1').fadeOut();
       $('.yunBei').css({'display':'none',"zIndex":999});
       $('.chenggong1 textarea').remove();
   });


    function back() {
        window.location.href='/SceneActivity/activity_list';
    }
</script>
<include file="Public/foot" />